package com.designpattern.simplefactory.ordinary;

/**
 * @author Liusr
 * @date 2023/2/27
 * @package com.designpattern.simplefactory.ordinary
 * @Description: 操作工厂类
 */
public class OperatorFactory {

	public static Operator getResult(String operatorChar) {
		Operator operator = null;
		switch (operatorChar) {
        case "+":
            operator = new AddOperator();
			break;
        case "-":
			operator = new SubtractOperator();
			break;
        case "*":
			operator = new MultiplyOperator();
			break;
        case "/":
			operator = new DivideOperator();
			break;
        }
		return operator;
	}
}
